<template>
	<view>
		<view class="content" v-if="activeList.length > 0">
      <view class="list" v-for="(item,index) of activeList" :key="index" @click="skip(item.id)">
        <!-- 图片开始 -->
        <view class="left">
          <image
            :src="item.image"
            mode="widthFix"
          />
        </view>
        <!-- 图片结束 -->

        <!-- 介绍开始 -->
        <view class="right">
          <view class="title">{{item.title}}</view>
          <view class="time">
            <text>{{item.start_at}}~{{item.end_at}}</text>
          </view>
          <view class="money">
            <view style="color:#f00">￥{{item.money}}</view>
            <view style="color:#a6a6a6">{{item.is_join ? '已参与' : '未参与'}}</view>
          </view>
        </view>
        <!-- 介绍结束 -->
      </view>
    </view>
	</view>
</template>
<script>
	import util from "@/common/util.js";
	import amap from '@/common/amap/amap.js';
	
	export default {
		
		data() {
			return {
				myInfo: {},
				detaildata:'',
				activeList:[], //获取的数据
			}
		},
		onLoad(options){
			try {
				const myInfo = uni.getStorageSync('myInfo');
				if (myInfo) {
					this.myInfo = myInfo;
					if (!!this.myInfo.is_request) {
						for (let i = 0; i < this.cityList.length; i++) {
							if (this.myInfo.is_request.pcode == this.cityList[i].value) {
								this.filter = this.cityList[i].label;
							}
						}
					} 
				}
			} catch (e) {
				console.warn(e)
			}
			this.getText('');
			
			uni.setNavigationBarTitle({
				title: options.title
			})
			
		},
		onPullDownRefresh() {
		
			setTimeout(() => {
        this.getText('');
			}, 500)
		},
		methods: {
      //跳转活动详情
      skip(id){
				uni.navigateTo({
						url: 'activity?id=' + id
					});
      },
			// 获取线下活动数据
			getText(val){
				console.log(
					{
					method: 'V1.Active',
					uid: this.myInfo.id,
					active_id:val,
				}
				)
				this.$api.api.ajaxData({
					method: 'V1.Active',
					uid: this.myInfo.id,
					active_id:val,
				}, res => {
					console.log('=====res====',res)
					if(res.code==200){
						if(val == ''){
							this.activeList = res.data;
							this.detaildata = res.data[0];
						} else {
							this.detaildata = res.data;
						}
					}
					
				}, err => {
					uni.hideLoading();
					
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	@import '../../common/common.scss';
	.content{
    width: 750rpx;
    .list{
      width: 680rpx;
      background-color: #eee;
      border-radius: 7rpx;
      margin-top: 10rpx;
      display: flex;
      margin: 10rpx auto;
      >view{
        margin-top: 20rpx;
      }
      .left{
        
        >image{
          width: 350rpx;
          border-radius: 7rpx;
        }
      }
      .right{
        >view{
          padding: 20rpx 10rpx;
        }
        .title{
        width: 300rpx;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
        }
        .time{
          color: #ffbc5d;
          font-size: 25rpx;
        }
        .money{
          display: flex;
          justify-content: space-between;
          padding-right: 30rpx;
        }
      }

    }
  }
</style>
				